﻿using FDStudio.Core.Entities;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq.Expressions;
using System.Text;

namespace FDStudio.Core.Repositories
{
    /*
     CreatedOn: 2018-03-07
     CreatedBy: Jackie Lee(天宇遊龍)
     */
    /// <summary>
    /// 只写仓储上下文
    /// </summary>
    public interface IWriteOnlyRepositoryContext : IRepositoryContext
    {
        /// <summary>
        /// 当插入数据时，获取新插入值自增列
        /// </summary>
        string AddedIDString { get; }

        bool Add<T>(T model) where T : class, IEntity;

        bool Update<T>(T model) where T : class, IEntity;

        bool Delete<T>(T model) where T : class, IEntity;

        bool Delete<T>(Expression<Func<T, bool>> condition) where T : class, IEntity;

        int ExecuteNonQuery(string sql, object parameter = null, CommandType commandType = CommandType.Text);
        
        void BeginTransaction();

        void CommitTransaction();

        void RollbackTransaction();
    }
}
